﻿using System;
using System.Linq;
using System.Configuration;
using System.Globalization;

namespace ForumsBrowser.ObjectGateway
{
    internal static class StringExtensions
    {
        public static DateTime? FromXmlToDateTime(this string value)
        {
            DateTime result;
            if (DateTime.TryParseExact(value, ConfigurationManager.AppSettings["DateTimeXmlFormat"], CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out result))
                return result;
            return null;
        }
    }
}
